﻿using BCCommon.Enums;
using BCEntity.Website.User;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace BCData.Website.User.UserAuth
{
    /// <summary>
    /// 用户授权数据处理接口
    /// </summary>
    public interface IUserAuthData
    {
        /// <summary>
		/// 是否存在该记录
		/// </summary>
		/// <param name="userAuthId">信息Id</param>
		Task<bool> Exists(long userAuthId);
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        /// <param name="authType">授权类型</param>
        /// <param name="unionId">授权唯一标识</param>
        Task<bool> Exists(AuthType authType, string unionId);
        /// <summary>
        /// 检查用户授权是否存在
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="authType">授权类型</param>
        /// <param name="unionId">唯一码</param>
        /// <returns></returns>
        Task<bool> CheckUserAuthExists(long userId, AuthType authType, string unionId);

        /// <summary>
        /// 添加用户授权
        /// </summary>
        /// <param name="userAuthEntity">用户授权</param>
        /// <returns></returns>
        Task<UserAuthEntity> Add(UserAuthEntity userAuthEntity);

        /// <summary>
        /// 更新用户授权
        /// </summary>
        /// <param name="userAuthEntity">用户授权</param>
        /// <returns></returns>
        Task<UserAuthEntity> Update(UserAuthEntity userAuthEntity);

        /// <summary>
        /// 获取授权信息
        /// </summary>
        /// <param name="unionId">唯一码</param>
        /// <returns></returns>
        Task<UserAuthEntity> Get(string unionId);

        /// <summary>
        /// 获取授权信息
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <returns></returns>
        Task<UserAuthEntity> Get(long userId);

        /// <summary>
        /// 获取授权信息
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="authType"></param>
        /// <returns></returns>
        Task<UserAuthEntity> Get(long userId, string authType);
        /// <summary>
        /// 获取员工授权信息
        /// </summary>
        /// <param name="authType">授权类型</param>
        /// <param name="unionId">授权唯一标识</param>
        Task<UserAuthEntity> GetEntity(AuthType authType, string unionId);
        /// <summary>
        /// 删除用户授权
        /// </summary>
        /// <param name="userAuthId">用户授权信息Id</param>
        void Delete(long userAuthId);
        /// <summary>
		/// 获取信息列表
		/// </summary>
        /// <param name="userId">用户Id</param>
		Task<IEnumerable<UserAuthEntity>> GetList(long userId);
    }
}
